import $math from "@src/common/math";

Component({
  options: {
    addGlobalClass: true
  },
  properties: {
    order: Object,
    productType: Number,
    bizData: Object,
    payRule: Object,
  },
  data: {
    dialogShow: false
  },
  lifetimes: {
    ready() {
      let totalFee = 0;
      Object.values(this.data.bizData.roomPrices).forEach(value => {
        totalFee += value;
      });
      totalFee = $math.mul(totalFee, this.data.bizData.num, 0);
      totalFee = $math.div(totalFee, 100, 2);

      let order = this.data.order
      let payFee = $math.div(order.totalFee - order.pointsDiscountFee - order.discountFee-order.supermemberPointsDiscountFee, 100, 2);
      let roomPriceDataArr = Object.keys(this.data.bizData.roomPrices);
      this.setData({totalFee: totalFee, roomPriceDataArr, payFee})
    }
  },
  methods: {
    handleStop() {
      return true;
    },
    open() {
      this.setData({dialogShow: true})
    },
    handleClose() {
      this.setData({dialogShow: false})
    }
  }
});
